# INSTRUCTIONS FOR LANGUAGE MODDING

Do you want to add a new translation to the game?
Do you want to expand an existing translation?
Or, do you just want to change the names of things around?

This guide will explain how to do all those things

## Basic modding overview

See "MODDING.TXT" in the root directory

## Adding a new language

There are four things you need to do to add a new language to Dicey Dungeons:

1. Add csv files for translated game content
2. Add a meta.json file that describes the locale's font settings & other data
3. Append your new languages to the list of supported languages
4. Append your new language's words for existing languages (ex: if adding 
Spanish, append the word "Inglés" for rendering the word "English" in Spanish)

## Add csv files

First, you'll want to copy the csv files of an existing locale, such as French
or German. You can find these files in "<Game root>/data/text/locale" under the 
various two-letter language code folders.

Then, add your language's folder within the mod. So if I'm adding, say, 
Norwegian Bokmål, I would add "<Mod root>/data/text/locale/nb". Paste the csv
files here, then open it in the editor of your choice, remove the old translated
words and provide your own. Also be sure to update the header line. Here's
data/text/locale/fr/equipment.csv for example:

Changed?,Name,Description,Extended,Name_fr,Description_fr,Extended_fr,

For a locale with the id "nb" you'd change that to:

Changed?,Name,Description,Extended,Name_nb,Description_nb,Extended_nb,

Note that the only cells you want to change here are those with the locale
suffix ("_nb" in this example).

## Add meta file

Okay you've added your CSV files. Now you need to provide a meta.json. I
recommend you start by copying the "<Game root>/data/text/locale/en/meta.json" 
and copying that into your new locale folder in your mod. Open it there and 
change the "id" and "name" fields at minimum to match your new language. You
can also tweak various locale-specific font settings from here and even specify 
a custom title screen (if you reference a new one, you'll also have to add that
in your Mod root folder as a new graphic).

## Append ids to list of supported languages

Add a new text file to this directory:
<Mod root>/_append/data/text/locale/supportedlanguages.txt

It should contain nothing but a list of language ids, each on their own line. So
if I was adding Polish, Norwegian, and Russian it would simply be:

pl
nb
ru

These language ids will be added to the master supportedlanguages.txt file which
determines which languages are chooseable from the startup screen. You can use
this behavior to toggle languages on and off while you're working on them.

Note that if you don't add your new language here, even if it's 100% perfect it
will NOT appear as a choice in the language menu.

## Append your language's words for other languages

Each language folder should have a name.csv file which lists how the word for
that language is rendered in every *other* language. For example, English, in
English, is "English". In French it's "Anglais", and in Spanish it's "Inglés."

So using Norwegian Bokmål again as an example, I need to add this line to
English's "name.csv" file:

nb,Engelsk

To do that, create a "name.csv" file in <Mod root>/_append/data/text/locales/en

Then, add this to it:

Locale,Name
nb, Engelsk

If your mod was adding more than one line, you could add several here. The 
header of a CSV file in the "_append" folder of your mod will not be redundantly
appended, it's just there to indicate the CSV structure.

Congratulations! Assuming you didn't break anything, your language mod should
be ready to go! Language mods, when designed correctly, should play very nicely
together with just about any other mod, especially other language mods.

## TODO

Troubleshooting, other things.